<?php
/**
 * Desc:
 * User: lisgroup
 * Date: 2018/5/18
 */

namespace App\HttpController\Api;


use EasySwoole\Core\Swoole\Task\TaskManager;

class Multi extends AbstractBase
{
    public function index()
    {
        $this->response()->write('Multi Index <br>'.PHP_EOL);
        // 测试异步
        $response = $this->response();
        TaskManager::async(function() use ($response){
            sleep(1);
            var_dump($response);
            $response->write('In Async '.time());
        });
        $this->response()->write('Sync '.time());
    }
}
